1  Cellestial Overview

Cellestial is an interactive single-cell plotting library.

import cellestial as cl
import scanpy as sc

from lets_plot import *

LetsPlot.setup_html()

data = sc.read("data/pbmc3k_pped.h5ad")

1.1 Tooltips

By default, cellestial produces HTML plots with geoms reveal tooltips when hovering.

plot = cl.dimensional(data, dimensions="umap", key="leiden", size=0.6)
plot

dimensional plot produces dimensionalilty reduction plots by taking dimensions argument. Yet, the subset of plots pca, umap and tsne are also available.

Also, the expression plot is also a subset of dimensional plot but it only works with genes.

1.2 Zooming and Paning

There are also zoomable and panable if specified.

plot = cl.dimensional(data, dimensions="umap", key="leiden", size=0.6, interactive=True)
plot

Note that this functionality can be added via + ggtb() layer of lets_plot.

1.3 High Customizability

Cellestial uses Lets-Plot, a ggplot2 impelementation in Pyton. As such, it allows adding or changing layers. Including color palettes, titles, labels, size etc., .

Here an example with switching color palette to hue which is also the ggplot2 and Seurat defaults, .

gggrid(
    [
        plot + scale_color_hue() + labs(title="Change color palette"),
        plot + theme(legend_text=element_text(size=15)) + labs(title="Change legend text size"),
        plot + theme(axis_title=element_blank()) + labs(title="Remove axis titles"),
    ]
) + ggsize(1400, 450)

Indeed, you can modify the size.

plot += ggsize(500, 400)
plot

1.4 Multi-Plots

Multi-plots uses dimensional plot and grids list of keys given.

While single-plot functions which generate a single-plot object, Multi-plot functions have plural names which provides predictable behaviors.

So, pca becomes pcas, umap becomes umaps, tsne becomes tsnes etc., for multi-plots.

tsene_grid = cl.umaps(
    data,
    keys=["leiden", "HBD", "NEAT1", "IGKC"],
    ncol=2,
    size=0.6,
    color_high="#D2042D",  # works with hex codes, rgb codes, and names (red, blue, etc.)
) + ggsize(900, 700)
tsene_grid